home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Kara Collection
/
Kara Collection v3.0 (1996-09-12)(Cloanto).iso
/
utilities
/
h
/
0
/
6
/
2
/
rexx
/
viewfile.ctrx
< prev
next >
Wrap
Text File
|
1996-05-02
|
1KB
|
59 lines
/* ColorType Amiga Rexx script - Copyright © 1996 Cloanto Italia srl */
/* $VER: ViewFile.ctrx 1.0 */
/**
This script shows how to create a simple text viewer. It displays the
selected text file in a window.
*/
IF ARG(1, EXISTS) THEN
PARSE ARG CTPORT
ELSE
CTPORT = 'COLORTYPE'
IF ~SHOW('P', CTPORT) THEN DO
IF EXISTS('ColorType:ColorType') THEN DO
ADDRESS COMMAND 'Run >NIL: ColorType:ColorType'
DO 30 WHILE ~SHOW('P',CTPORT)
ADDRESS COMMAND 'Wait >NIL: 1 SEC'
END
END
ELSE DO
SAY "ColorType could not be loaded."
EXIT 10
END
END
IF ~SHOW('P', CTPORT) THEN DO
SAY 'ColorType Rexx port could not be opened.'
EXIT 10
END
ADDRESS VALUE CTPORT
OPTIONS RESULTS
OPTIONS FAILAT 10000
LockGUI
RequestFile '"Select a text file"'
IF RC = 0 THEN DO
PARSE VALUE RESULT WITH '"' fname '"'
IF OPEN('textfile', fname, R) THEN DO
filetext = ''
DO UNTIL EOF('textfile')
filetext = filetext || READCH('textfile', 10000)
END
CALL CLOSE('textfile')
pos = 1
DO FOREVER
pos = INDEX(filetext, '"', pos)
IF pos = 0 THEN
BREAK
filetext = INSERT('"', filetext, pos)
pos = pos + 2
END
RequestNotify '"File contents" "'filetext'" SCROLL WRAPCHECK'
END
END
UnlockGUI